import API from '@/utils/request'

export function getPageAddress({ pageNum, pageSize }) {
	return API.get('/address/page', {
		params: {
			pageNum,
			pageSize
		}
	})
}

//前台获取地址列表
export function getPageAddressFront({ pageNum, pageSize, name }) {
	return API.get('/address/page/front', {
		params: {
			pageNum,
			pageSize,
			name
		}
	})
}

export function getAllAddress() {
	return API.get('/address')
}

export function getAddressById(id) {
	return API.get(`/address/${id}`)
}
// 保存地址
export function saveAddress(address) {
	return API.post('/address', address)
}

export function updateAddress(address) {
	return API.put('/address', address)
}

export function removeAddress(id) {
	return API.delete(`/address/${id}`)
}

// 查询可选地址
export const findDistrict = () => {
	return API.get('/sDistrict')
}
